package com.hns.phone.energy.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hns.can.master.service.TendencyChartsDataTools;
import com.hns.frame.mybatis.Pagination;
import com.hns.frame.service.CommonService;
import com.hns.phone.common.vo.PhoneParamsVo;
import com.hns.phone.energy.vo.CarEnergyTendencyVo;
import com.hns.phone.energy.vo.EnergyAdviceBhvVo;
import com.hns.phone.energy.vo.EnergyCostListVo;
import com.hns.phone.energy.vo.EnergyExceptionRanking;
import com.hns.phone.energy.vo.EnergyRiseDriverVo;
import com.hns.phone.energy.vo.EnergyStatusConcludeVo;
import com.hns.phone.energy.vo.EnergyStatusInfoVo;
import com.hns.phone.energy.vo.LineEnergyOperationVo;
import com.hns.phone.energy.vo.LineMileListVo;
import com.hns.tool.pub.PubUtil;

@Service
public class PhoneLineEnergyService extends CommonService {

	@Autowired
	private TendencyChartsDataTools tendencyChartsDataTools;
	
	@SuppressWarnings("unchecked")
	public List<LineEnergyOperationVo> getOperationInfo(PhoneParamsVo vo) {
		List<LineEnergyOperationVo> list = PubUtil.convertListMapToObject(this.sqlMapDao.selectList("lineEnergy.energyOperationInfo", vo), LineEnergyOperationVo.class);
		return list;
	}

	@SuppressWarnings("unchecked")
	public List<CarEnergyTendencyVo> getMileTendency(PhoneParamsVo vo) {
//		List<CarEnergyTendencyVo> list = PubUtil.convertListMapToObject(this.sqlMapDao.selectList("lineEnergy.energyMileTendency", vo), CarEnergyTendencyVo.class);
		List tmpList = tendencyChartsDataTools.fillSingleTendencyData(this.sqlMapDao.selectList("lineEnergy.energyMileTendency", vo), vo.getDateType());
		List<CarEnergyTendencyVo> list = PubUtil.convertListMapToObject(tmpList, CarEnergyTendencyVo.class);
		return list;
	}

//	public Pagination getLineMileList(PhoneParamsVo vo) {
//		Pagination page = this.myBatisPage("lineEnergy.lineMileListCount", "lineEnergy.lineMileListData", vo, LineMileListVo.class);
//		return page;
//	}

	public List<CarEnergyTendencyVo> getEnergyCostTendency(PhoneParamsVo vo) {
		List tmpList = tendencyChartsDataTools.fillMultiTendencyData(this.sqlMapDao.selectList("lineEnergy.energyCostTendency", vo), vo.getDateType());
		List<CarEnergyTendencyVo> list = PubUtil.convertListMapToObject(tmpList, CarEnergyTendencyVo.class);
		return list;
	}

	public Pagination getEnergyCostList(PhoneParamsVo vo) {
		Pagination page = this.myBatisPage("lineEnergy.energyCostRankingCount", "lineEnergy.energyCostRanking", vo, EnergyCostListVo.class);
		return page;
	}

	public List<EnergyStatusInfoVo> getEnergyStatusInfo(PhoneParamsVo vo) {
		List<EnergyStatusInfoVo> list = PubUtil.convertListMapToObject(this.sqlMapDao.selectList("lineEnergy.energyStatusInfo", vo), EnergyStatusInfoVo.class);
		return list;
	}

	public List<EnergyStatusConcludeVo> getEnergyStatusConclude(PhoneParamsVo vo) {
		List<EnergyStatusConcludeVo> list = PubUtil.convertListMapToObject(this.sqlMapDao.selectList("lineEnergy.energyStatusConclude", vo), EnergyStatusConcludeVo.class);
		return list;
	}

	public List<EnergyRiseDriverVo> getEnergyRiseDrivingBhv(PhoneParamsVo vo) {
		List<EnergyRiseDriverVo> list = PubUtil.convertListMapToObject(this.sqlMapDao.selectList("lineEnergy.energyRiseDrivingBhv", vo), EnergyRiseDriverVo.class);
		return list;
	}

	public List<EnergyAdviceBhvVo> getEnerAdviceBhv(PhoneParamsVo vo) {
		List<EnergyAdviceBhvVo> list = PubUtil.convertListMapToObject(this.sqlMapDao.selectList("lineEnergy.enerAdviceBhv", vo), EnergyAdviceBhvVo.class);
		return list;
	}

	/**
	 * 形式里程列表（前五）
	 * @param vo
	 * @return
	 * @author:zhangyu
	 * @email:zhangyu2222z@sina.cn
	 */
	public List<EnergyExceptionRanking> getLineMileListForFive(PhoneParamsVo vo) {
		List<EnergyExceptionRanking> list = PubUtil.convertListMapToObject(this.sqlMapDao.selectList("lineEnergy.getLineMileListForFive", vo), EnergyExceptionRanking.class);
		return list;
	}
	
}
